package games.eightPuzzle.heuristics;

import games.eightPuzzle.states.*;

/**
 * @author avishl02
 * an improved Manhattan Distances heuristic
 */
public class ImprovedMDHuristic implements Heuristic{
	
	private LinearConflictHeuristic _LCH = null;
	private MDHeuristic _MDH = null;
	private CornerTilesHuristic _CTH = null;
    private LastMoveHeuristic _LMH = null;

	int _bFactor = 100;
	
	//ctor
	public ImprovedMDHuristic(SlidingPuzzleState finalState,int branckingFactor){
		_LCH = new LinearConflictHeuristic(finalState);
		_MDH = new MDHeuristic(finalState);
		_CTH = new CornerTilesHuristic(finalState);
		_LMH = new LastMoveHeuristic(finalState);
		_bFactor = branckingFactor;//branckingFactor;
	}
	
	/* (non-Javadoc)
	 * @see ai.ex1.heuristics.Heuristic#rank(ai.ex1.SlidingPuzzleState)
	 */
	public int rank(SlidingPuzzleState state) {
		return _MDH.rank(state)*_bFactor + _LCH.rank(state) +_CTH.rank(state) + _LMH.rank(state);
	}

}
